<!DOCTYPE html>
<html>


<!-- Mirrored from www.zi-han.net/theme/hplus/form_basic.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:19:15 GMT -->

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <link rel="shortcut icon" href="favicon.ico">
    <link href="__PUBLIC__/dist/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/dist/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/dist/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="__PUBLIC__/dist/css/plugins/switchery/switchery.css" rel="stylesheet">
    <link href="__PUBLIC__/dist/css/animate.min.css" rel="stylesheet">
    <link href="__PUBLIC__/dist/css/style.min862f.css?v=4.1.0" rel="stylesheet">
    <link href="__PUBLIC__/dist/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css" rel="stylesheet">

</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">

        <div class="row">
            <div class="col-sm-12">
                <div class="tabs-container">
                    <ul class="nav nav-tabs">
                        <li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true">通用信息</a></li>
                        <li class=""><a data-toggle="tab hide" href="#tab-2" aria-expanded="false">详情描述</a></li>
                        <li class=""><a data-toggle="tab hide" href="#tab-3" aria-expanded="false">商品相册</a></li>
                    </ul>
                    <form method="post" class="form-horizontal">
                        <div class="tab-content">
                            <!--通用信息-->
                            <div id="tab-1" class="tab-pane active">
                                <div class="panel-body">
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">商品名称</label>
                                        <div class="col-sm-10">
                                            <input type="text" class="form-control" name="goods_name" value="{$info.goods_name}"
                                                required>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>

                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">价格</label>
                                        <div class="col-sm-10">
                                            <input type="text" name="price" class="form-control" value="{$info.price|round=2}"
                                                required>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>

                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">押金</label>
                                        <div class="col-sm-10">
                                            <input type="text" name="deposit_amount" class="form-control" value="{$info.deposit_amount|round=2}" required>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">销售方式</label>
                                        <div class="col-sm-10">
                                            <select name="sale_mode" class="form-control" required>
                                                <option value="0" {if condition="0 eq $info['sale_mode']"}selected{/if} >出售</option>
                                                <option value="1" {if condition="1 eq $info['sale_mode']"}selected{/if} >租借</option>
                                                <option value="2" {if condition="2 eq $info['sale_mode']"}selected{/if} >出售/租借</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group hide">
                                        <label class="col-sm-2 control-label">套餐</label>
                                        <div class="col-sm-2">
                                            <input type="checkbox" class="js-switch-1" id="item_mode" name="item_mode"
                                                value="1" {if condition="$info['item_mode'] eq 1" }checked{/if} />
                                        </div>
                                    </div>
                                    <div class="form-group hide" id="goods_items_html">
                                        <label class="col-sm-2 control-label">单品列表</label>
                                        <div class="col-sm-10" id="goods_items_content">
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">上架</label>
                                        <div class="col-sm-2">
                                            <input type="checkbox" class="js-switch" name="is_on_sale" value="1" {if condition="$info['is_on_sale'] eq 1 or $info['is_on_sale'] eq null"}checked{/if} />
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">封面图</label>
                                        <div class="col-sm-3" id="file-pretty">
                                            <div class="input-append input-group">
                                                <span class="input-group-btn">
                                                    <button class="btn btn-white" type="button" onclick="GetUploadify(1,'','goods','call_back');">选择文件</button>
                                                </span>
                                                <input class="input-large form-control" id="original_img_input" type="text"
                                                    name="image" value="{$info.image}">
                                            </div>
                                        </div>
                                        <div class="col-sm-1" id="original_img" style="position: relative;">
                                            {if condition="$info['image']"}
                                            <img src="{$info.image}" alt="" class="goods-image" style="height:34px">
                                            <div style="position:absolute;bottom:0;left:65px;display:none;border: 1px solid #ccc;"><img
                                                    src="{$info.image}" alt="" style="max-width: 500px;z-index: 999"></div>
                                            {/if}
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group hide">
                                        <label class="col-sm-2 control-label">
                                            添加库存数量
                                            <p style="color:red;">
                                                (目前库存：{$info.store_count})
                                            </p>
                                        </label>
                                        <div class="col-sm-10">
                                            <input type="text" name="store_count" class="form-control" value="0"
                                                required>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed hide"></div>
                                    <div class="form-group draggable ui-draggable hide">
                                        <label class="col-sm-2 control-label">通用属性</label>
                                        <div class="col-sm-10">
                                            <div class="checkbox checkbox-success checkbox-inline">
                                                <input type="checkbox" class="power_parent_id_52" value="1" id="is_recommend" name="is_recommend" {if condition="$info.is_recommend eq 1"}checked{/if}> 
                                                <label for="is_recommend">
                                                是否推荐
                                                </label>
                                            </div>
                                            <div class="checkbox checkbox-success checkbox-inline">
                                                <input type="checkbox" class="power_parent_id_52" value="1" id="is_hot" name="is_hot" {if condition="$info.is_hot eq 1" }checked{/if}>
                                                <label for="is_hot">
                                                是否热销
                                                </label>
                                            </div>
                                            <div class="checkbox checkbox-success checkbox-inline">
                                                <input type="checkbox" class="power_parent_id_52" value="1" id="is_new" name="is_new" {if condition="$info.is_new eq 1" }checked{/if}>
                                                <label for="is_new">
                                                是否新品
                                                </label>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed hide"></div>
                                    <div class="form-group">
                                        <div class="col-sm-4 col-sm-offset-2">
                                            <button class="btn btn-primary" type="submit">保存内容</button>
                                            <button class="btn btn-white" type="button" onclick="history.back()">取消</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!--详情描述-->
                            <div id="tab-2" class="tab-pane hide">
                                <div class="panel-body">
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">备注</label>
                                        <div class="col-sm-10">
                                            <textarea name="description" id="editor2">{$info.description}</textarea>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>

                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">商品详情</label>
                                        <div class="col-sm-10">
                                            <textarea name="content" id="editor">{$info.content}</textarea>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <div class="col-sm-4 col-sm-offset-2">
                                            <button class="btn btn-primary" type="submit">保存内容</button>
                                            <button class="btn btn-white" type="button" onclick="history.back()">取消</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!--服务相册-->
                            <div id="tab-3" class="tab-pane hide">
                                <div class="panel-body">
                                    <div class="hr-line-dashed"></div>
                                    <div class="row" id="photoBox">
                                        <div class="col-md-2 " style="text-align: center">
                                            <a href="javascript:;" class="fa fa-plus-square-o" onclick="GetUploadify(10,'','goods','call_back2');"
                                                style="width: 100%;font-size: 155px;"></a>
                                        </div>

                                        <div class="col-md-2 photoModel" style="display:none">
                                            <div class="ibox-content text-center" style="border: 0;">
                                                <div class="m-b-sm">
                                                    <img alt="image" src="__PUBLIC__/dist/img/a8.jpg" style="max-width: 100%;max-height: 110px;">
                                                </div>

                                                <div class="text-center">
                                                    <a href="javascript:;" class="btn btn-xs btn-white delImage"
                                                        data-path=""><i class="fa fa-trash-o"></i> 删除 </a>
                                                </div>
                                            </div>
                                        </div>
                                        {foreach name="goodsImages" item="item"}
                                        <div class="col-md-2">
                                            <div class="ibox-content text-center" style="border: 0;">
                                                <div class="m-b-sm">
                                                    <img alt="image" src="{$item.image}" style="max-width: 100%;max-height: 110px;">
                                                </div>

                                                <div class="text-center">
                                                    <a href="javascript:;" class="btn btn-xs btn-white delImage"
                                                        data-path="{$item.image}"><i class="fa fa-trash-o"></i> 删除 </a>
                                                </div>
                                            </div>
                                            <input type="hidden" name="goods_images[]" value="{$item.image}">
                                        </div>
                                        {/foreach}
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <div class="col-sm-4 col-sm-offset-2">
                                            <button class="btn btn-primary" type="submit">保存内容</button>
                                            <button class="btn btn-white" type="button" onclick="history.back()">取消</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>


    <script src="__PUBLIC__/dist/js/jquery.min.js?v=2.1.4"></script>
    <script src="__PUBLIC__/dist/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="__PUBLIC__/dist/js/content.min.js?v=1.0.0"></script>
    <script src="__PUBLIC__/dist/js/plugins/iCheck/icheck.min.js"></script>
    <script src="__PUBLIC__/dist/js/plugins/switchery/switchery.js"></script>
    <script type="text/javascript" charset="utf-8" src="__PUBLIC__/libs/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="__PUBLIC__/libs/ueditor/ueditor.all.min.js"> </script>
    <script type="text/javascript" charset="utf-8" src="__PUBLIC__/libs/global.js?rnd=12345678"> </script>
    <script>
        UE.getEditor('editor');
        UE.getEditor('editor2');
        var item_mode_btn = document.querySelector('.js-switch-1');
        new Switchery(document.querySelector('.js-switch'));
        new Switchery(item_mode_btn);
        $(document).ready(function () { $(".i-checks").iCheck({ checkboxClass: "icheckbox_square-green", radioClass: "iradio_square-green", }) });

        function item_mode_fun() {
            //获取按钮的选中状态
            var is_checked = item_mode_btn.checked;
            goods_items_select(is_checked);
        }

        function goods_items_select(is_checked) {
            if (is_checked) {
                $('#goods_items_html').removeClass('hide');
                $.ajax({
                    type: 'GET',
                    url: "{:Url('Goods/ajax_items_html')}",
                    data: { goods_id: '{$info.id}' },
                    success: function (html) {
                        $('#goods_items_content').html(html);
                    }
                });
            } else {
                $('#goods_items_html').addClass('hide');
            }
        }

        $(function () {
            item_mode_btn.onchange = function () {
                item_mode_fun();
            };

            var is_checked = item_mode_btn.checked;
            goods_items_select(is_checked);
        });

        /*
         * 以下是图片上传方法
         */
        // 上传服务图片成功回调函数
        function call_back(fileurl_tmp) {
            $("#original_img").html('<img src="' + fileurl_tmp + '" alt="" style="height:34px">');
            $('#original_img_input').val(fileurl_tmp);
        }

        // 上传服务相册回调函数
        function call_back2(paths) {
            for (var i = 0; i < paths.length; i++) {
                var clone = $('.photoModel').clone(true);
                clone.find('img').attr('src', paths[i]);
                clone.find('.delImage').attr('data-path', paths[i]);
                clone.append('<input type="hidden" name="goods_images[]" value="' + paths[i] + '">');
                clone.removeClass('photoModel');
                $('#photoBox').append(clone.show());
            }
        }

        //删除服务相册图片
        $('.delImage').click(function () {
            var obj = $(this);
            var path = obj.data('path');
            $.ajax({
                type: 'GET',
                url: "{:Url('Uploadify/delupload')}",
                data: { action: "del", filename: path },
                success: function () {
                    $(obj).parents('.col-md-2').remove(); // 删除完服务器的, 再删除 html上的图片
                }
            });
            // 删除数据库记录
            $.ajax({
                type: 'GET',
                url: "{:Url('Goods/del_goods_images')}",
                data: { filename: path },
                success: function () {
                    //
                }
            });
        });
        $('.goods-image').mouseover(function () {
            $(this).next().show();
        }).mouseout(function () {
            $(this).next().hide();
        });
    </script>

</body>


<!-- Mirrored from www.zi-han.net/theme/hplus/form_basic.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:19:15 GMT -->

</html>